package com.yc.favorite.servlet;

import com.yc.favorite.biz.FavoriteBiz;
import com.yc.favorite.util.ServletUtils;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/delFav")
public class DelFavServlet extends HttpServlet {
    FavoriteBiz fbiz = new FavoriteBiz();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        final String fid = req.getParameter("fid");
        ServletUtils.result("删除成功!", resp,
                () -> {
                    fbiz.deleteFavorite(Integer.parseInt(fid));
                });
    }
}
